package org.dromara.system.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum SysUserFreezePointsRecordsEnum {


    REGISTER_DECREASE_POINTS(1, "注册奖励积分"),
    TRADING_DECREASE_POINTS(2, "交易扣除冻结积分"),
    STAGE_DECREASE_POINTS(3, "阶段返现扣除冻结积分"),
    INVITE_GET_MACHINE_DECREASE_POINTS(4, "邀请商户领取机具奖励冻结积分"),
    INVITE_REGISTER_DECREASE_POINTS(5, "邀请商户注册奖励冻结积分"),
    VIP_DECREASE_POINTS(6, "开通VIP奖励冻结积分"),

    ;
    @JsonValue
    @EnumValue
    private final Integer code;
    private final String name;

    public static SysUserFreezePointsRecordsEnum findOne(Integer code) {
        return Arrays.stream(SysUserFreezePointsRecordsEnum.values())
            .filter(type -> type.getCode().equals(code)).findAny().orElse(null);
    }
}
